<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:hmrList="http://java.sun.com/jsf/composite/list">

		<p:outputPanel layout="block" style="height:100%" rendered="#{equipmentBean.equipment != null}">
			<h:panelGrid style="height:85%;max-width:1200px" columns="2" columnClasses="top-align,top-align" > 
				<h:column>
					<h:form id="formEquipmentData" prependId="false">
						<div  style="display:block;height:90%;">
							<h:panelGrid columns="2" style="width:400px;" > 
				            <h:outputLabel value="#{msgs.Name} :" for="equipmentName" />
				            <p:inputText id="equipmentName"     value="#{equipmentBean.equipment.name}" maxlength ="20" size="20" required="false" requiredMessage="#{msgs.EquipmentNameObligatory}"  />
				
							<h:outputLabel value="#{msgs.Description} :" for="equipmentDescription" />
							<p:inputTextarea id="equipmentDescription" rows="4" cols="50"
								counter="counterEquipmentDescription" maxlength="180"
								counterTemplate="{0} #{msgs.CharsRemaining}" autoResize="false"
								value="#{ equipmentBean.equipment.description}" />
							<p:spacer />
							<h:outputText id="counterEquipmentDescription" />
			
							<h:outputLabel value="#{msgs.Obs} :" for="equipmentObs" />
							<p:inputTextarea id="equipmentObs" rows="4" cols="50"
								counter="counterEquipmentObs" maxlength="180"
								counterTemplate="{0} #{msgs.CharsRemaining}" autoResize="false"
								value="#{ equipmentBean.equipment.obs}" />
							<p:spacer />
							<h:outputText id="counterEquipmentObs" />
			
			
				            <h:outputText value="#{msgs.Status} :" />
				            <p:selectOneRadio value="#{equipmentBean.equipment.active}" >
				                <f:selectItem itemLabel="#{msgs.Active}"  	itemValue="true"   />
				                <f:selectItem itemLabel="#{msgs.Inactive}"	itemValue="false" />
				            </p:selectOneRadio>
			
							<h:outputLabel 	value="#{msgs.CreatedAt} :"		for="equipmentCreatedAt" rendered="#{equipmentBean.equipment.id != null}"  />
							<p:inputText  	id="equipmentCreatedAt" 	value="#{equipmentBean.equipment.createdAt}" disabled="true" rendered="#{equipmentBean.equipment.id != null}"  >
								<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
							</p:inputText>
			
							<h:outputLabel 	value="#{msgs.ChangedAt} :"		for="equipmentChangedAt" rendered="#{equipmentBean.equipment.id != null}" />
							<p:inputText  	id="equipmentChangedAt" 	value="#{equipmentBean.equipment.lastChange}" disabled="true" rendered="#{equipmentBean.equipment.id != null}" >
								<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />
							</p:inputText>
			
							<h:outputLabel 	value="#{msgs.ChangedBy} :"		for="equipmentChangedBy" rendered="#{equipmentBean.equipment.id != null}" />
							<p:inputText  	id="equipmentChangedBy" 	value="#{equipmentBean.equipment.changedBy.email}" disabled="true" rendered="#{equipmentBean.equipment.id != null}" />
							
							<h:outputLabel 	value="#{msgs.Library} :"		for="equipmentLibrary" />
							<p:selectOneMenu id="equipmentLibrary" value="#{equipmentBean.equipment.library}"	  disabled="#{equipmentBean.equipment.id != null}" converter="#{libraryConverter}">
				            	<f:selectItems value="#{equipmentBean.activeUser.librarys}" var="library" itemLabel="#{library.name}" itemValue="#{library}" />
							</p:selectOneMenu>
	
						</h:panelGrid>
						</div>
						<div align="left"   >
							<p:commandButton  value="#{msgs.Save}"		action="#{equipmentBean.saveEquipment}"		
								ajax="true"	update=":content, :growl, :listEquipmentForm"		icon="ui-icon-disk"	rendered="#{equipmentBean.equipment.id != null}" />
							<p:commandButton  value="#{msgs.Create}"	action="#{equipmentBean.createEquipment}"	
								ajax="true"	update=":content, :growl, :listEquipmentForm"		icon="ui-icon-document"	rendered="#{equipmentBean.equipment.id == null}" />
							<p:spacer width="50px"/>	
							<p:commandButton   value="#{msgs.Cancel}" update=":content, :growl"	action="#{equipmentBean.cancelChange}"	icon="ui-icon-cancel"/>
						</div>
					</h:form>
				</h:column>
				<h:column >
					<p:accordionPanel  style="margin-left:10px;width:700px">
						<p:tab title="#{msgs.EquipmentPhotos}"  >
							<hmrList:photosList photosHandler="#{equipmentBean.photosListHandler}" />
						</p:tab>
						<p:tab title="#{msgs.EquipmentVideos}" >
							<hmrList:videosList videosHandler="#{equipmentBean.videosListHandler}" />
						</p:tab>
					</p:accordionPanel>  
				</h:column>
			</h:panelGrid>	
		</p:outputPanel>			
</html>